import request from '@/utils/request';
import { CodeUrl, OrderItem } from '@/type/orderType';
import { Response } from '@/type/ResponseType';

enum Enum {
  fetchOrderInfoAPI = '/order/orderInfo/auth/getOrderInfo',
  cancelMakeAPI = '/order/orderInfo/auth/cancelOrder',
  createNativeAPI = '/order/weixin/createNative',
  queryPayStatusAPI = '/order/weixin/queryPayStatus'
}

/**
 * @description 查询订单详情的接口
 * */
export const fetchOrderInfoAPI = (orderId: string) => request.get<OrderItem, Response<OrderItem>>(`${Enum.fetchOrderInfoAPI}/${orderId}`);

/**
 * @description 取消预约的接口
 * */
export const cancelMakeAPI = (orderId: string) => request.get<string, Response<string>>(`${Enum.cancelMakeAPI}/${orderId}`);

/**
 *@description 创建二维码url图片的接口
 */

export const createNativeAPI = (orderId: string) => request.get<CodeUrl, Response<CodeUrl>>(`${Enum.createNativeAPI}/${orderId}`);

/**
 *@description 查询订单支付状态的接口
 */

export const queryPayStatusAPI = (orderId: string) => request.get<boolean, Response<boolean>>(`${Enum.queryPayStatusAPI}/${orderId}`);
